const { Schema, model } = require('mongoose');

const productsSchema = new Schema(
  {
    name: String,
    price: Number,
    information: String,
    year: String,
    imgURL: String,
    classifyId: {
      type: Schema.Types.ObjectId, // mongoose 中 _id 属性的类型
      ref: 'Classify', // 指定关联集合的模型名称
    },
  },
  {
    versionKey: false,
  }
);

const Products = model('Products', productsSchema, 'products');
module.exports.Products = Products;
